<template>
	<view>
		<u-navbar title="企业健康体检"></u-navbar>
		
		<view class="roundcenter">
			<view class="round">
				<view class="avatar">
					<image src="@/static/img/logox.png"></image>
				</view>
			</view>
			<view class="formcontent">
				<u-form :model="form" ref="uForm">
					<u-form-item label="企业名称" prop="name" required label-width="140" border-bottom>
						<u-input v-model="form.name" placeholder="请输入企业名称" />
					</u-form-item>
					<u-form-item label="企业属于以下哪一类型" prop="sex" required label-width="140" border-bottom :label-position="'top'">
						<u-radio-group v-model="form.sex">
							<u-radio active-color="#ffc92a" v-for="(item, index) in sexList" :key="item.name"
								:name="item.name" :disabled="item.disabled">
								{{ item.name }}
							</u-radio>
						</u-radio-group>
					</u-form-item>
					<u-form-item label="企业目前处于以下哪一个发展阶段" prop="sex" required label-width="140" border-bottom :label-position="'top'">
						<u-radio-group v-model="form.jieduan">
							<!-- 初创期/发展期/成熟期/衰退期 -->
							<u-radio active-color="#ffc92a"
								:name="'初创期'" >
								初创期
							</u-radio>
							<u-radio active-color="#ffc92a"
								:name="'发展期'" >
								发展期
							</u-radio>
							<u-radio active-color="#ffc92a"
								:name="'成熟期'" >
								成熟期
							</u-radio>
							<u-radio active-color="#ffc92a"
								:name="'衰退期'" >
								衰退期
							</u-radio>
						</u-radio-group>
					</u-form-item>
					<u-form-item label="企业成立时间" prop="shijian" required label-width="140" border-bottom :label-position="'top'">
						<u-radio-group v-model="form.shijian">
							<!-- 不足2年/3—5年/5—10年/10—20年/超过20 -->
							<u-radio active-color="#ffc92a"
								:name="'不足2年'" >
								不足2年
							</u-radio>
							
							<u-radio active-color="#ffc92a"
								:name="'2—5年'" >
								2—5年
							</u-radio>
							<u-radio active-color="#ffc92a"
								:name="'5—10年'" >
								5—10年
							</u-radio>
							<u-radio active-color="#ffc92a"
								:name="'10—20年'" >
								10—20年
							</u-radio>
							<u-radio active-color="#ffc92a"
								:name="'超过20年'" >
								超过20年
							</u-radio>
						</u-radio-group>
					</u-form-item>
					<u-form-item label="企业规模大小" prop="guimo" required label-width="140" border-bottom :label-position="'top'">
						<u-radio-group v-model="form.guimo">
							<!-- 规下/规上/中型/大型/多元化 -->
							<u-radio active-color="#ffc92a"
								:name="'规下'" >
								规下
							</u-radio>
							<u-radio active-color="#ffc92a"
								:name="'规上'" >
								规上
							</u-radio>
							<u-radio active-color="#ffc92a"
								:name="'中型'" >
								中型
							</u-radio>
							<u-radio active-color="#ffc92a"
								:name="'大型'" >
								大型
							</u-radio>
							<u-radio active-color="#ffc92a"
								:name="'多元化'" >
								多元化
							</u-radio>
						</u-radio-group>
					</u-form-item>
					<!-- <u-form-item label="年龄阶段" prop="age" required label-width="140" border-bottom>
						<u-input v-model="form.age" placeholder="请输入年龄" />
					</u-form-item>
					<u-form-item label="联系方式" prop="tel" len="11" required label-width="140" border-bottom>
						<u-input v-model="form.tel" placeholder="请输入联系方式" />
					</u-form-item> -->
				</u-form>
			</view>
		</view>
		<view class="organization combg">
<!-- 			<view class="organizationtitle">
				<image src="../img/organ.png"></image>
				<text>测评机构</text>
			</view> -->
			<view class="savebutton" @click="submit">开始测评</view>
			<!-- 			<navigator url="/pages/questions/questions" open-type="navigate">
				
			</navigator> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					name: '',
					age: '',
					tel: '',
					sex: ''
				},
				sexList: [{
						name: '服务业',
						disabled: false
					},
					{
						name: '制造业',
						disabled: false
					}
				],
				rules: {
					name: [{
						required: true,
						message: '请输入企业名称',
						trigger: ['change', 'blur']
					}],
					sex: [{
						required: true,
						message: '请选择企业类型',
						trigger: ['change', 'blur']
					}],
					jieduan: [{
						required: true,
						message: '请选择企业发展阶段',
						trigger: ['change', 'blur']
					}],
					shijian: [{
						required: true,
						message: '请选择企业成立时间',
						trigger: ['change', 'blur']
					}],
					guimo: [{
						required: true,
						message: '请选择企业规模大小',
						trigger: ['change', 'blur']
					}],
				}
			}
		},
		onShow() {
			let that = this;
			if (this.$options.filters.isLogin("auth")) {

			} else {
				uni.showModal({
				 title: "提示",
					content: "检测到您的账号还未登录,是否去登录？",
					confirmColor: this.$lightColor,
					success: function(res) {
						if (res.confirm) {
							that.$options.filters.navigateToLogin();
						} else if (res.cancel) {
							uni.navigateBack();
						}
					},
				});
			}
			
		},
		methods: {
			submit() {
				console.log("submit************")
				this.$refs.uForm.validate(valid => {
					if (valid) {
						uni.setStorageSync("mlaform",this.form);
						// uni.navigateTo({
						// 	url: '/pages/wenda/report/report'
						// });
						uni.navigateTo({
							url: '/pages/wenda/qiyejiankang/qiyejiankang'
						});
						
					} else {
						console.log('验证失败');
					}
				});
			}
		},
		onReady() {
			this.$refs.uForm.setRules(this.rules);
		}
	}
</script>

<style scoped>
	page {
		background-color: #3f48cc;
	}

	.roundcenter {
		width: 686rpx;
		margin: 60rpx auto 0 auto;
		background: #fff;
		box-shadow: 0 40rpx 0 -22rpx rgb(63 72 204 / 23%), 0 -9px 0 0 rgb(63 72 204 / 14%) inset;
		border-radius: 50rpx;
	}

	.round {
		width: 100%;
		height: 124rpx;
		background: url(../img/roundbg.png) no-repeat 50%/100%;
	}

	.avatar {
		width: 125rpx;
		height: 135rpx;
		border-radius: 50%;
		box-shadow: 0 -9rpx 0 0 rgb(105 100 87 / 14%) inset;
		margin: auto;
	}

	.avatar image {
		width: 125rpx;
		height: 125rpx;
	}

	.formcontent {
		padding: 40rpx;
	}

	.formcontent .label-text span {
		font-size: 26rpx;
	}

	.organization .organizationtitle image {
		width: 32rpx;
		height: 30rpx;
		vertical-align: middle;
		margin-right: 10rpx;
	}

	.organization .organizationtitle text {
		font-size: 28rpx;
		vertical-align: middle;
		color: #857f77;
	}

	.savebutton {
		width: 622rpx;
		line-height: 90rpx;
		color: #fff;
		font-size: 32rpx;
		font-weight: 700;
		/* margin: 70rpx auto; */
		text-align: center;
		background: url(../img/savebtn.png) no-repeat 50%/100%;
	}
</style>
